<?php

/**
 * 
 *
 * @version $Id: one_news2.inc.php,v 1.4 2004/08/21 13:43:24 phppc Exp $
 * @copyright 2004 
 **/

	$ue_array = $this->uf_form_conf(array("n_title","n_main"));
	if ($ue_array == 1) {
	   	if ($_POST["actual_time"] == 1) $nstart = $this->config["aktuelle_zeit"];
		else $nstart = gmmktime ($_POST["s_stunde"],$_POST["s_minute"],0,$_POST["s_monat"],$_POST["s_tag"],$_POST["s_jahr"],0) - $time_add;
		if ($_POST["use_nend"] == 1) $nend = gmmktime ($_POST["e_stunde"],$_POST["e_minute"],0,$_POST["e_monat"],$_POST["e_tag"],$_POST["e_jahr"],0) - $time_add;
		else $nend = 0;
		$_POST["n_title"] = addslashes(htmlspecialchars($_POST["n_title"]));
		$_POST["n_main"] = addslashes(htmlspecialchars($_POST["n_main"]));
		if ($action == "create_news") {
			if ($this->perm_array["news_write"] == 2) $news_active = 1;
			else $news_active = 0;
			$abfrage = "INSERT ".$this->config["prefix"]."main (n_title,n_text,kat,links,user_id,time_start,time_end,active) VALUES (\"$_POST[n_title]\",\"$_POST[n_main]\",\"$_POST[kat_id]\",\"$_POST[n_links]\",\"$user_id\",\"$nstart\",\"$nend\",\"$news_active\")";
			$news_id = $this->db_insert_id();
		}
		elseif ($action == "edit_news") {
			$abfrage = "UPDATE ".$this->config["prefix"]."main SET n_title = \"$_POST[n_title]\", n_text = \"$_POST[n_main]\", kat = \"$_POST[kat_id]\", links = \"$_POST[n_links]\", time_start = \"$nstart\", time_end = \"$nend\" WHERE news_id = \"$_POST[news_id]\"";
			$news_id = $_POST["news_id"];
		}
		$erg = $this->db_abfrage_q ($abfrage);
	}else {
		$this->message_red[] = 1;
		if ($action == "create_news") {
			$this->w_leitung["number"] = 1;
			$this->w_leitung["url"] = "$PHP_SELF?action=create_news&schritt=1&ncs=$this->ncs";
		}
	}
?>